﻿// <copyright file="CategoryService.cs" company="Clever Software">
// Copyright (c) 2013, 2014 All Right Reserved, http://www.cleversoftware.by
//
// This source is subject to the Microsoft Permissive License.
// Please see the License.txt file for more information.
// All other rights reserved.
//
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY 
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// </copyright>
// <author>Clever Software</author>
// <email>info@cleversoftware.by</email>
// <date>2014-02-04</date> 
// <summary>CleverCMS source code</summary>


//TODO: Replace with Genric<CmsPageCategory>
namespace CleverCMS.Cms.Services
{
    using CleverCMS.Cms.Data;
    using CleverCMS.Cms.Data.Entities;
    using System.Collections.Generic;

    public class CategoryService
    {
        private readonly ICmsGenericRepository<CmsPageCategory> _categoriesRepo;

        /// <summary>
        /// .Ctor
        /// </summary>
        /// <param name="categoriesRepo"></param>
        public CategoryService(ICmsGenericRepository<CmsPageCategory> categoriesRepo) 
        {
            this._categoriesRepo = categoriesRepo;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public IEnumerable<CmsPageCategory> GetAll()
        {
            return _categoriesRepo.LoadAll();
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="category"></param>
        public void Save(CmsPageCategory category)
        {
            _categoriesRepo.Save(category, true);
        }
    }
}